<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="Apache Forrest" name="Generator">
<meta name="Forrest-version" content="0.8">
<meta name="Forrest-skin-name" content="pelt">
<title>Frequently Asked Questions</title>
<link type="text/css" href="skin/basic.css" rel="stylesheet">
<link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
<link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
<link type="text/css" href="skin/profile.css" rel="stylesheet">
<script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
<link rel="shortcut icon" href="">
</head>
<body onload="init()">
<script type="text/javascript">ndeSetTextSize();</script>
<div id="top">
<!--+
    |breadtrail
    +-->
<div class="breadtrail">
<a href="http://www.apache.org/">apache</a> &gt; <a href="http://xml.apache.org/">xml</a> &gt; <a href="http://xmlgraphics.apache.org/">graphics</a><script src="skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
</div>
<!--+
    |header
    +-->
<div class="header">
<!--+
    |start group logo
    +-->
<div class="grouplogo">
<a href="http://xmlgraphics.apache.org/"><img class="logoImage" alt="Apache XML Graphics" src="images/group-logo.png" title="Apache XML Graphics"></a>
</div>
<!--+
    |end group logo
    +-->
<!--+
    |start Project Logo
    +-->
<div class="projectlogoA1">
<a href="http://xmlgraphics.apache.org/batik/"><img class="logoImage" alt="Apache Batik" src="images/batik.png" title="Apache Batik"></a>
</div>
<!--+
    |end Project Logo
    +-->
<!--+
    |start Tabs
    +-->
<ul id="tabs">
<li class="current">
<a class="selected" href="index.html">Home</a>
</li>
<li>
<a class="unselected" href="tools/index.html">Tools and applications</a>
</li>
<li>
<a class="unselected" href="using/index.html">Using Batik</a>
</li>
<li>
<a class="unselected" href="dev/index.html">Development</a>
</li>
</ul>
<!--+
    |end Tabs
    +-->
</div>
</div>
<div id="main">
<div id="publishedStrip">
<!--+
    |start Subtabs
    +-->
<div id="level2tabs"></div>
<!--+
    |end Endtabs
    +-->
<script type="text/javascript"><!--
document.write("Last Published: " + document.lastModified);
//  --></script>
</div>
<!--+
    |breadtrail
    +-->
<div class="breadtrail">

             &nbsp;
           </div>
<!--+
    |start Menu, mainarea
    +-->
<!--+
    |start Menu
    +-->
<div id="menu">
<div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Project</div>
<div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
<div class="menuitem">
<a href="index.html">Overview</a>
</div>
<div class="menuitem">
<a href="license.html">License</a>
</div>
<div class="menuitem">
<a href="download.cgi">Download</a>
</div>
<div class="menuitem">
<a href="install.html">Installation notes</a>
</div>
<div class="menuitem">
<a href="status.html">Status</a>
</div>
<div class="menuitem">
<a href="demo.html">Demo</a>
</div>
<div class="menupage">
<div class="menupagetitle">FAQs</div>
</div>
<div class="menuitem">
<a href="mailing-lists.html">Mailing lists</a>
</div>
<div class="menuitem">
<a href="contributors.html">Contributors</a>
</div>
<div class="menuitem">
<a href="http://issues.apache.org/bugzilla/buglist.cgi?query_format=specific&bug_status=__open__&product=Batik">Bug database</a>
</div>
<div class="menuitem">
<a href="uses.html">Projects using Batik</a>
</div>
<div class="menuitem">
<a href="http://www.apache.org/foundation/sponsorship.html">ASF sponsorship program</a>
</div>
<div class="menuitem">
<a href="http://www.apache.org/foundation/thanks.html">ASF thanks</a>
</div>
</div>
<div onclick="SwitchMenu('menu_1.2', 'skin/')" id="menu_1.2Title" class="menutitle">Resources</div>
<div id="menu_1.2" class="menuitemgroup">
<div onclick="SwitchMenu('menu_1.2.1', 'skin/')" id="menu_1.2.1Title" class="menutitle">Specifications</div>
<div id="menu_1.2.1" class="menuitemgroup">
<div onclick="SwitchMenu('menu_1.2.1.1', 'skin/')" id="menu_1.2.1.1Title" class="menutitle">For SVG 1.1</div>
<div id="menu_1.2.1.1" class="menuitemgroup">
<div class="menuitem">
<a href="http://www.w3.org/TR/SVG11/">SVG 1.1</a>
</div>
<div class="menuitem">
<a href="http://www.w3.org/TR/REC-CSS2/">CSS Level 2</a>
</div>
<div class="menuitem">
<a href="http://www.w3.org/TR/DOM-Level-2-Core/">DOM Level 2 Core</a>
</div>
<div class="menuitem">
<a href="http://www.w3.org/TR/DOM-Level-2-Events/">DOM Level 2 Events</a>
</div>
<div class="menuitem">
<a href="http://www.w3.org/TR/DOM-Level-2-Style/">DOM Level 2 Style</a>
</div>
<div class="menuitem">
<a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMAScript 3rd ed.</a>
</div>
<div class="menuitem">
<a href="http://www.w3.org/TR/2001/REC-smil-animation-20010904/">SMIL Animation</a>
</div>
</div>
<div onclick="SwitchMenu('menu_1.2.1.2', 'skin/')" id="menu_1.2.1.2Title" class="menutitle">For SVG 1.2</div>
<div id="menu_1.2.1.2" class="menuitemgroup">
<div class="menuitem">
<a href="http://www.w3.org/TR/SVGMobile12/">SVG Tiny 1.2 (draft)</a>
</div>
<div class="menuitem">
<a href="http://www.w3.org/TR/SVG12/">SVG Full 1.2 (draft)</a>
</div>
<div class="menuitem">
<a href="http://www.w3.org/TR/DOM-Level-3-Core/">DOM Level 3 Core</a>
</div>
<div class="menuitem">
<a href="http://www.w3.org/TR/DOM-Level-3-Events/">DOM Level 3 Events (draft)</a>
</div>
<div class="menuitem">
<a href="http://www.w3.org/TR/DOM-Level-3-XPath/">DOM Level 3 XPath (note)</a>
</div>
</div>
</div>
<div class="menuitem">
<a href="http://wiki.apache.org/xmlgraphics-batik/FrontPage">Batik wiki</a>
</div>
<div class="menuitem">
<a href="http://wiki.svg.org/">SVG wiki</a>
</div>
<div class="menuitem">
<a href="http://groups.yahoo.com/group/svg-developers/">SVG Developers mailing list</a>
</div>
<div class="menuitem">
<a href="http://lists.w3.org/Archives/Public/www-svg/">W3C SVG mailing list</a>
</div>
<div class="menuitem">
<a href="http://svg.jibbering.com/">#svg IRC channel</a>
</div>
</div>
<div id="credit"></div>
<div id="roundbottom">
<img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
<!--+
  |alternative credits
  +-->
<div id="credit2">
<a href="http://eu.apachecon.com/"><img border="0" title="ApacheCon Europe 2008" alt="ApacheCon Europe 2008 - logo" src="http://apache.org/ads/ApacheCon/2008-europe-125x125.png" style="width: 125px;height: 125px;"></a>
</div>
</div>
<!--+
    |end Menu
    +-->
<!--+
    |start content
    +-->
<div id="content">
<h1>Frequently Asked Questions</h1>
<a name="N1000D"></a><a name="Questions"></a>
<h2 class="boxed">Questions</h2>
<div class="section">
<a name="N10011"></a><a name="part-general"></a>
<h3 class="boxed">1. General questions</h3>
<a name="N10015"></a><a name="what-is-batik"></a>
<h4 class="faq">1.1. What is Batik?</h4>
<div align="right">
<a href="#what-is-batik-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          Batik is a Java-based toolkit for applications or applets that want
          to use images in the <a class="external" href="http://www.w3.org/TR/SVG11/">Scalable
            Vector Graphics (SVG)</a> format for various purposes, such as
          display, generation or manipulation.        
        </p>
</div>
<a name="N10021"></a><a name="what-is-svg"></a>
<h4 class="faq">1.2. What is SVG?</h4>
<div align="right">
<a href="#what-is-svg-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          
<a class="external" href="http://www.w3.org/TR/SVG11/">SVG</a> (Scalable Vector
          Graphics) is an open-standard language for describing 
          two-dimensional (2D) graphics in XML. It is a Recommendation from the 
          <a class="external" href="http://www.w3.org/">W3C</a>. SVG lets you describe rich images
          with features such as gradients, transparency, filter effects and animation.
        </p>
<p>
          SVG has three types of graphic objects: shapes (e.g., paths consisting 
          of straight lines and curves), images and text. Graphical objects can be grouped, 
          styled, transformed and composited (e.g., drawn with transparency). SVG has a 
          large set of static features which includes nested transformations, clipping 
          paths, masking and filter effects.
        </p>
<p>
          In addition, SVG images can be dynamic and interactive. A rich set of event
          handlers such as for mouse movement and clicks can be assigned to any SVG
          graphical object. These handlers can invoke scripts, which, in response to an
          event, can dynamically modify the SVG graphic through the SVG Document Object Model
          (DOM) API, allowing, for example scripts to change the color or location of graphical 
          elements.
        </p>
<p>
          SVG graphical elements can be animated through scripting. Alternatively,
          animation sequences can be expressed directly in XML because SVG leverages the
          <a class="external" href="http://www.w3.org/TR/2001/REC-smil-animation-20010904/">SMIL Animation</a>
          specification for multimedia, another
          <a class="external" href="http://www.w3.org/">W3C</a> specification. 
        </p>
</div>
<a name="N10042"></a><a name="what-can-i-do"></a>
<h4 class="faq">1.3. What can I do with Batik?</h4>
<div align="right">
<a href="#what-can-i-do-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          Batik contains several <a href="using/architecture.html">core modules</a>
          which can be used independently or jointly to <strong>generate SVG
            content</strong> (see the <a href="using/svg-generator.html">SVG Generator</a>
          and <a href="using/dom-api.html">SVG DOM</a> implementation documentation)
          <strong>view SVG content</strong> (see the <a href="using/swing.html">JSVGCanvas</a>)
          or <strong>convert to and from the SVG format</strong> (see the 
          <a href="using/transcoder.html">SVG Transcoder</a> page).
        </p>
<p>
          In addition, Batik contains
          <a href="using/architecture.html#lowLevelComponents">low level
            modules</a>, such as an object-oriented Graphic Vector Toolkit
          (GVT), a set of low level parsers specific to the SVG syntax and a
          set of <a href="using/extending.html">extensions</a> to the Java 2D API
          (such as sophisticated fill types and filter effects).
        </p>
<p>
          Finally, Batik comes with <a href="tools/">packaged applications</a> to help developers get
          familiar with the code and be quickly able to use the various modules: Squiggle, an
          <a href="tools/browser.html">SVG browser</a> (in the 
          <span class="codefrag">org.apache.batik.apps.svgbrowser</span> package) an 
          <a href="tools/rasterizer.html">SVG rasterizer</a> (in the 
          <span class="codefrag">org.apache.batik.apps.rasterizer</span> package), a
          <a href="tools/font-converter.html">Font converter</a> (in the
          <span class="codefrag">org.apache.batik.apps.ttf2svg package</span>) and an 
          <a href="tools/pretty-printer.html">SVG pretty printer</a> (in the 
          <span class="codefrag">org.apache.batik.apps.svgpp package</span>).</p>
<p>
          Squiggle, the <a href="tools/browser.html">SVG browser</a> can display SVG
          documents and lets the user zoom, pan and rotate any SVG document,
          view the SVG source, link between SVG documents, view a tree
          representation of the SVG DOM and more. One important component of
          the SVG viewer is the <span class="codefrag">org.apache.batik.swing.JSVGCanvas</span>
          component, which can be plugged in to any Java application or applet
          to provide SVG viewing capability.
        </p>
<p>
          The <a href="tools/rasterizer.html">SVG rasterizer</a>
          lets the user convert
          SVG files to raster formats such as JPEG, PNG or TIFF . It
          contains an extensible mechanism so that arbitrary raster
          formats can be added. For example, the rasterizer lets you
          create one SVG file with a special effect (e.g., shadows,
          gradients, etc.), turn it into a PNG image, then modify the
          SVG source (e.g., modify a piece of text or a color), and
          generate another PNG image from it. This way, you can easily
          generate a series of images sharing a common theme or look and
          feel to post on a web site. (Note that the rasterizer can also
          be used on a web server to do this conversion automatically).
        </p>
<p>
          The <a href="tools/font-converter.html">SVG Font Converter</a>
          lets the user easily create
          an <a class="external" href="http://www.w3.org/TR/SVG11/fonts.html">SVG
            Font</a> for a set of characters from a TrueType Font
          file. That SVG Font definition can be embedded in a document
          using the characters. This allows users to create SVG
          documents that are self contained and do not rely on system
          fonts, and guarantees that the SVG file will be displayed
          exactly as it was authored on all platforms.
        </p>
<p>
          The <a href="tools/pretty-printer.html">SVG Pretty Printer</a>
          is a convenience tool to
          pretty print an SVG document, which means that you can
          reformat any existing SVG document to produce a nicely
          formatted and highly legible version.
        </p>
<p>
          These applications show that Batik can be used client side
          (the browser can be used on any client machine) and server
          side (the rasterizer can be used to serve SVG images to client
          machines that do not have SVG support).
        </p>
</div>
<a name="N100BB"></a><a name="why-at-apache"></a>
<h4 class="faq">1.4. Why do we have such a project at Apache?</h4>
<div align="right">
<a href="#why-at-apache-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          The <a href="http://xmlgraphics.apache.org/charter.html">mission
            of the Apache XML Graphics Project</a> is to promote the use of
          XML-based graphics by &ldquo;providing robust, full-featured,
          commercial-quality, and freely available software packages for the
          conversion of XML to graphical output and for related components&rdquo;.
          Batik as an open source implementation of a key format for today&rsquo;s
          and tomorrow&rsquo;s web fits well in this mission.
        </p>
</div>
<a name="N100C7"></a><a name="how-does-batik-relate"></a>
<h4 class="faq">1.5. How does Batik relate to other Apache projects?</h4>
<div align="right">
<a href="#how-does-batik-relate-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          Batik is used in <a class="external" href="http://cocoon.apache.org/">Cocoon</a> 
          for server side rasterization of SVG images. In addition, the Batik is used in the 
          <a href="http://xmlgraphics.apache.org/fop/">FOP</a> project to convert 
          SVG images to PDF format.
        </p>
</div>
<a name="N100D7"></a><a name="how-did-it-start"></a>
<h4 class="faq">1.6. How did it start?</h4>
<div align="right">
<a href="#how-did-it-start-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          Batik started out because several teams doing SVG related projects decided to join 
          efforts with the idea that the whole will be greater than the sum of the parts. The
          following companies or institutions are part of the team that contributed and/or
          created the initial Batik project, during the fall of 2000:
        </p>
<ul>
          
<li>
<a class="external" href="http://www.csiro.au/">CSIRO</a>
</li>
          
<li>
<a class="external" href="http://www.ilog.com/">ILOG</a>
</li>
          
<li>
<a class="external" href="http://koala.ilog.fr/">Koala Team</a>
</li>
          
<li>
<a class="external" href="http://www.kodak.com/">Eastman Kodak Company</a>
</li>
          
<li>
<a class="external" href="http://www.sun.com/">Sun Microsystems, Inc.</a>
</li>
        
</ul>
<p>
          In addition, the Batik project is supported by <a class="external" href="http://www.ibm.com/">IBM</a>.
        </p>
<p>
          We encourage anyone to participate. As with all ASF projects, all efforts are
          volunteer-based. We are looking for individuals to work with us on
          fulfilling our goals for Batik in the spirit of collaborative open-source
          software development.
        </p>
</div>
<a name="N10105"></a><a name="what-is-next"></a>
<h4 class="faq">1.7. Where is Batik going? What is next?</h4>
<div align="right">
<a href="#what-is-next-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          The SVG implementation is not complete (see the current
          <a href="status.html">status</a>), and there is more work to
          do to achieve a fully functional viewer.
        </p>
<p>
          Batik 1.1 supports all static SVG features, 
          linking and a limited support for scripting, and the 1.5 release
          completed support for scripting and dynamic documents.
          With Batik 1.6 came many improvements to
          the implementation of SVG DOM functions, bug fixes, performance
          improvements, and the beginning of some SVG 1.2 support.
          Declarative animation and some SVG 1.2 features were introduced
          in Batik 1.7beta1.  Further SVG 1.2 functionality should be
          supported in the 2.0 release.
        </p>
<p>
          The type of applications (e.g., transcoding applications)
          that can or will be added to Batik depends on contributions
          and feedback.
        </p>
</div>
<a name="N10117"></a><a name="how-can-i-create-svg"></a>
<h4 class="faq">1.8. How can I create and author SVG content?</h4>
<div align="right">
<a href="#how-can-i-create-svg-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          Well, you can always use a plain text editor such as vi or
          xemacs, but there are many graphic authoring packages that can
          export SVG documents and that will let you author SVG content
          visually.
        </p>
<p>
          You can get a list of tools exporting SVG from the <a class="external" href="http://www.w3.org/Graphics/SVG/SVG-Implementations#edit">SVG
            implementation</a> section of the SVG Home page on the W3C
          web site. You can also imagine building a tool on top of
          Batik: feel free to contribute!
        </p>
<p>
          Authoring is one way of creating SVG content, and graphic
          authoring packages are useful for that purpose. However, there
          are many types of graphics which can be generated, such as
          stock quotes, statistical data, etc. For these types of
          graphics, there are many ways to generate SVG content. For
          example, if your data (say stock information) is contained in
          an XML document, you could use XSLT to transform your XML data
          into SVG. If your data comes from a database and you retrieve
          that data in a servlet on a Web server (e.g., using JDBC), you
          could use the Java binding for the DOM API to generate an SVG
          document from the database data. You could also use Batik&rsquo;s
          SVG generator and use the Java 2D API to generate that
          graphic.
        </p>
<p>
          The following URLs will be useful to learn more about each of 
          these solutions:
        </p>
<ul>
          
<li>
<a class="external" href="http://xml.apache.org/xalan-j/index.html">Xalan for XSLT</a>
</li>
          
<li>
<a class="external" href="http://xml.apache.org/xerces-j/index.html">Xerces</a> and
            <a class="external" href="http://java.sun.com/xml/download.html">Crimson</a> for the DOM API</li>
          
<li>
<a href="using/svg-generator.html">SVG Generator</a>
</li>
        
</ul>
</div>
<a name="N10143"></a><a name="what-other-svg-products-exist"></a>
<h4 class="faq">1.9. What other SVG products are out there?</h4>
<div align="right">
<a href="#what-other-svg-products-exist-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          There are many companies supporting SVG and you will find a list of 
          available implementations on the
          <a class="external" href="http://www.w3.org/Graphics/SVG/SVG-Implementations">W3C&rsquo;s SVG
            implementation page</a>.
        </p>
</div>
<a name="N1014F"></a><a name="svg-spec"></a>
<h4 class="faq">1.10. Where can I find the SVG specification?</h4>
<div align="right">
<a href="#svg-spec-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          The <a class="external" href="http://www.w3.org/TR/SVG11/">SVG specification</a> is
          available from the <a class="external" href="http://www.w3.org/">W3C web site</a>. 
        </p>
</div>
<a name="N1015F"></a><a name="how-much-does-batik-implement"></a>
<h4 class="faq">1.11. How much of SVG does Batik implement?</h4>
<div align="right">
<a href="#how-much-does-batik-implement-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          The <a href="status.html">status page</a> shows how much of the SVG
          specification Batik implements by showing which of the tests in the
          <a href="status.html#beSuiteStatus">SVG Basic Effectivity test
            suite</a> Batik successfully passes.
        </p>
</div>
<a name="N1016F"></a><a name="benefits-of-svg-being-xml"></a>
<h4 class="faq">1.12. What are the benefits of SVG being an XML grammar?</h4>
<div align="right">
<a href="#benefits-of-svg-being-xml-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          Being an XML grammar means SVG can leverage work done around
          XML, and SVG actually leverages other grammars such as
          <a class="external" href="http://www.w3.org/TR/2001/REC-xlink-20010627/">XLink</a>,
          for linking and
          <a class="external" href="http://www.w3.org/TR/2001/REC-smil-animation-20010904/#AnimationFramework">SMIL</a>
          for the animation.
        </p>
<p>
          Beyond the use and mix with other XML syntaxes, being an XML grammar
          lets SVG benefit from the plethora of XML tools that make it so easy
          to manipulate, generate, search and edit XML files.
        </p>
</div>
<a name="N10182"></a><a name="what-is-in-a-name"></a>
<h4 class="faq">1.13. Where does the name come from?</h4>
<div align="right">
<a href="#what-is-in-a-name-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          Batik is a highly evolved art tradition that developed in Java
          (one of the islands comprising what is now called
          Indonesia). Batik is generally thought of as the quintessentially
          Indonesian textile. Motifs of flowers, twining plants, leaves,
          buds, birds, butterflies, fish, insects and geometric forms are
          rich in symbolic association and variety; there are about three
          thousand recorded batik patterns.
        </p>
<p>
          We think that Batik gracefully evokes Java, graphics and
          high-quality, terms that constitute the core of the toolkit.
        </p>
<p>
          
<a class="external" href="http://www.expat.or.id/info/batik.html">This page</a>
          shows examples of what Batik textures look like.
        </p>
</div>
<a name="N10194"></a><a name="batik-help"></a>
<h3 class="boxed">2. Getting started with Apache Batik/SVG</h3>
<a name="N10198"></a><a name="system-requirements"></a>
<h4 class="faq">2.1. What are the system requirements to run Batik?</h4>
<div align="right">
<a href="#system-requirements-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          Batik is written in the Java language and requires a version 1.3
          implementation at this time. 
        </p>
</div>
<a name="N101A0"></a><a name="how-to-install"></a>
<h4 class="faq">2.2. How do I install Batik?</h4>
<div align="right">
<a href="#how-to-install-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          You will need the <a class="external" href="http://java.sun.com/">JDK 1.3</a> to run
          Batik.
        </p>
<p>
          To install Batik you need to <a href="download.cgi">download</a>
          the binary or source distribution and unzip it on your computer.
        </p>
<p>
          You can have a look at the <a href="install.html">installation
            instructions</a> for more information.
        </p>
</div>
<a name="N101BA"></a><a name="how-can-i-see-demo"></a>
<h4 class="faq">2.3. How can I see a demo?</h4>
<div align="right">
<a href="#how-can-i-see-demo-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          You can see an online demonstration of Squiggle the SVG
          browser on the <a href="demo.html">demo page</a>. Alternatively, you
          can <a href="download.cgi">download</a> Batik or see
          <a href="tools/browser.html">screenshots</a> of the Batik SVG viewer,
          images created from the <a href="tools/rasterizer.html">rasterizer</a> and
          an <a href="using/svg-generator.html">example</a> of how to use the
          <span class="codefrag">SVGGraphics2D</span> generator.
        </p>
</div>
<a name="N101D9"></a><a name="what-scripting-languages-batik-supports"></a>
<h4 class="faq">2.4. What scripting languages can I use in my SVG files?</h4>
<div align="right">
<a href="#what-scripting-languages-batik-supports-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          A limited support of scripting in SVG files is provided with
          the current version of Batik (script are executed but dynamic
          update is not supported).
        </p>
<p>
          Batik can recognize the following scripting languages:
        </p>
<ul>
          
<li>
            ECMAScript thanks to the
            <a class="external" href="http://www.mozilla.org/rhino/">Mozilla Rhino</a> JavaScript
            engine included in the distribution,
          </li>
          
<li>
            Python for which you need to download the
            <a class="external" href="http://www.jython.org">Jython</a> engine, and
          </li>
          
<li>
            Tcl for which you need to download the
            <a class="external" href="http://dev.scriptics.com/software/java/">Jacl</a> engine.
          </li>
        
</ul>
<p>
          To get more information on how to install optional
          scripting languages you can have a look at the
          <a href="install.html">installation instructions</a>.
        </p>
</div>
<a name="N10203"></a><a name="batik-error"></a>
<h3 class="boxed">3. Troubleshooting Apache Batik</h3>
<a name="N10207"></a><a name="NoSuchMethodException"></a>
<h4 class="faq">3.1. 
        When I try to run Batik it results in a NoSuchMethodException.  What
        is the problem?
      </h4>
<div align="right">
<a href="#NoSuchMethodException-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          There is certainly something wrong with your classpath. Clear your
          <span class="codefrag">CLASSPATH</span> environment variable and be sure to remove
          all the libraries which use the W3C&rsquo;s DOM bindings from
          <span class="codefrag">jre/lib/ext</span> before running any of the Batik&rsquo;s
          applications.
        </p>
</div>
<a name="N10215"></a><a name="display-does-not-update"></a>
<h4 class="faq">3.2. 
        When I change the document in Java it doesn&rsquo;t update the
        display, even if I call repaint?
      </h4>
<div align="right">
<a href="#display-does-not-update-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          There are two common causes for this.  The first is that the
          <a class="class" href="javadoc/org/apache/batik/swing/JSVGCanvas.html">JSVGCanvas</a>
          doesn&rsquo;t know it&rsquo;s a dynamic document.  Normally
          Batik detects this by looking for script elements but when you
          modify the document from Java it can&rsquo;t tell.  So call
        </p>
<pre class="code">myJSVGCanvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);</pre>
<p>
          before loading the document (with <span class="codefrag">setURI</span>,
          <span class="codefrag">setDocument</span>, <span class="codefrag">setSVGDocument</span>, etc.).
        </p>
<p>
          The second common reason is that the changes aren&rsquo;t made in
          the
          <a class="class" href="javadoc/org/apache/batik/bridge/UpdateManager.html">UpdateManager</a>&rsquo;s
          thread.  You can run code in the <span class="codefrag">UpdateManager</span>&rsquo;s thread
          with the following:
        </p>
<pre class="code">UpdateManager um = JSVGCanvas.getUpdateManager();
um.getUpdateRunnableQueue().invokeLater(Runnable);</pre>
<p>
          
<strong>NOTE:</strong> The update manager only becomes
          available after the first rendering completes.  You can
          be notified when this happens by registering a 
          <span class="codefrag">GVTTreeRendererListener</span>.
        </p>
</div>
<a name="N1024A"></a><a name="must-mouseover-to-change"></a>
<h4 class="faq">3.3. 
        When I change the document in Java it only updates if I
        move the mouse over the canvas?
      </h4>
<div align="right">
<a href="#must-mouseover-to-change-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          The most common causes for this, is that the changes are not made in
          the <span class="codefrag">UpdateManager</span>&rsquo;s thread.  See previous FAQ for
          example code to run code in the Update Manager&rsquo;s thread.  Moving the
          mouse works because it delivers the mouse move events in the update
          thread, and after a runnable completes in the
          <span class="codefrag">UpdateManager</span>&rsquo;s thread it checks if the canvas needs
          repainting.
        </p>
</div>
<a name="N10258"></a><a name="changes-are-not-rendered"></a>
<h4 class="faq">3.4. 
        When I create new SVG elements or modify some SVG attributes through
        the DOM API, from ECMAScript, nothing happens, the changes are not
        rendered. Why not?
      </h4>
<div align="right">
<a href="#changes-are-not-rendered-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          A common problem is that script contain the wrong DOM calls
          to create elements or modify attributes.
        </p>
<p>
          SVG elements need to be created in the SVG namespace. For example,
          to create a <span class="codefrag">rect</span> element, you should use
        </p>
<pre class="code">document.createElementNS(svgNS, "rect");</pre>
<p>
          (where <span class="codefrag">svgNS</span> is equal to
          <span class="codefrag">"http://www.w3.org/2000/svg"</span>), which appropriately
          creates the <span class="codefrag">rect</span> element in the SVG namespace. A call to
        </p>
<pre class="code">document.createElement("rect")</pre>
<p>
          creates an element with the name <span class="codefrag">rect</span> but which does not
          belong to the SVG namespace. As such, it is ignored by Batik.
        </p>
<p>
          Most SVG attributes belong to what is called the &ldquo;per element type 
          partition namespace&rdquo; (see the
          <a class="external" href="http://www.w3.org/TR/REC-xml-names">Namespaces in XML</a>
          specification). The appropriate way to set attributes on an SVG
          element is a call to <span class="codefrag">setAttributeNS</span> with a namespace
          value of <span class="codefrag">null</span>, for example:
        </p>
<pre class="code">elt.setAttributeNS(null, "width", "40");</pre>
<p>
          In the Batik SVG DOM implementation, you can also use a call to
          <span class="codefrag">setAttribute</span> and you can write
        </p>
<pre class="code">elt.setAttribute("width", "40")</pre>
<p>
          However, it is important to know that some implementations make a
          difference between <span class="codefrag">setAttribute(x, y)</span> and
          <span class="codefrag">setAttributeNS(null, x, y)</span>, so it is goo practice
          to use <span class="codefrag">setAttributeNS</span> which is the only guaranteed
          interoperable way of setting attributes in a namespace aware DOM
          implementation.
        </p>
<p>
          Finally, for attributes which belong to a specific namespace, like the 
          the <span class="codefrag">href</span> attribute on the <span class="codefrag">image</span> element,
          you have to use the <span class="codefrag">setAttributeNS</span> method with the
          XLink namespace.  For example, assuming <span class="codefrag">img</span> references an 
          <span class="codefrag">image</span> DOM <span class="codefrag">Element</span>, you can modify the 
          href as follows:
        </p>
<pre class="code">img.setAttributeNS(xlinkNS, "xlink:href", "myImage.jpg");</pre>
<p>
          where <span class="codefrag">xlinkNS</span> is equal to
          <span class="codefrag">"http://www.w3.org/1999/xlink"</span>.
        </p>
<p>
          For more information on common authoring pitfalls, see Jonathan Watt&rsquo;s 
          <a class="external" href="http://jwatt.org/svg/authoring/">SVG Authoring
            Guidelines</a>.
        </p>
</div>
<a name="N102D0"></a><a name="null-updatemanager"></a>
<h4 class="faq">3.5. 
        When I get the UpdateManager from the canvas sometimes
        it is null, why?
      </h4>
<div align="right">
<a href="#null-updatemanager-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          The <span class="codefrag">JSVGCanvas</span> is highly asynchronous so when you call
          <span class="codefrag">setURI</span>, <span class="codefrag">setDocument</span> or
          <span class="codefrag">setSVGDocument</span> they return essentially immediately.
          Behind the scenes, the canvas creates the rendering tree and does a
          first rendering after dispatching the document <span class="codefrag">SVGLoad</span>
          event.  Only after this first rendering does the
          <span class="codefrag">UpdateManger</span> become available.
        </p>
</div>
<a name="N102EA"></a><a name="why-updatemanager"></a>
<h4 class="faq">3.6. 
        Why do I have to go through the UpdateManager to
        run my code? Can&rsquo;t you just synchronize the DOM?
      </h4>
<div align="right">
<a href="#why-updatemanager-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          It would be possible to synchronize individual calls to
          the DOM, however in general this is almost useless for the
          way DOM works.  For example creating a single rectangle
          element takes approximately 6 individual DOM calls.  So
          higher level synchronization is needed.
        </p>
<p>
          The use of a
          <a class="external" href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runnable.html">Runnable</a>
          is a common way of accomplishing synchronization for a block of code.
          This is essentially the approach that Swing takes (all Swing
          modification should take place in the Swing thread).  It was
          considered to use the Swing event thread, but this would lock the
          user interface while scripts were working.
        </p>
</div>
<a name="N102FA"></a><a name="extension-tags-work-with-source-not-binary"></a>
<h4 class="faq">3.7. 
        I can use the Batik extension tags with the source distribution
        but not with the binary distribution.  What am I missing?
      </h4>
<div align="right">
<a href="#extension-tags-work-with-source-not-binary-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          When running from the source distribution you automatically get the
          service provider entries for the Batik extension elements
          (such as <span class="codefrag">regularPolygon</span> and <span class="codefrag">star</span>).
          We chose not to include these by default in the
          binary distribution for the Batik applications.
        </p>
<p>
          There is a subdirectory called <span class="codefrag">extensions</span> that has jar
          files that enable the extended elements from Batik.
        </p>
</div>
<a name="N1030E"></a><a name="red-circles"></a>
<h4 class="faq">3.8. 
        Why do I get red circles when I view the samples/extensions files?
      </h4>
<div align="right">
<a href="#red-circles-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          You are using the binary distribution. This distribution does not
          include support for our example extensions (they are just examples
          and other people can do more sophisticated things).
        </p>
<p>
          If you want to view these examples you need to use the extension
          enabled versions of the applications in the <span class="codefrag">extensions</span>
          subdirectory.
        </p>
</div>
<a name="N1031C"></a><a name="dom-modifications-do-not-display"></a>
<h4 class="faq">3.9. 
        I am modifying the DOM after displaying it in the JSVGCanvas,
        but my changes aren&rsquo;t shown (even if I call repaint).
      </h4>
<div align="right">
<a href="#dom-modifications-do-not-display-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          For efficiency, if Batik loads a static document it doesn&rsquo;t
          set up any dynamic support.  Batik normally decides whether a
          document is dynamic by checking if it contains any
          <span class="codefrag">script</span> elements or event handler attributes.  However,
          if your Java application is modifying the DOM directly there may be
          no script elements.  In this case you need to tell Batik to set up
          dynamic support regardless.
        </p>
<p>
          You can inform the <span class="codefrag">JSVGCanvas</span> that a document should
          be handled dynamically by calling the <span class="codefrag">setDocumentState</span>
          method, just before loading the document:
        </p>
<pre class="code">JSVGCanvas myCanvas = ...;
myCanvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
myCanvas.setURI("myFile.svg");</pre>
</div>
<a name="N10334"></a><a name="batik-fails-with-fop-on-org.w3c.xxx"></a>
<h4 class="faq">3.10. 
        I am trying to use Batik and FOP together but Batik does not work and
        fails on the org.w3c.* packages. What is happening?
      </h4>
<div align="right">
<a href="#batik-fails-with-fop-on-org.w3c.xxx-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          Both FOP and Batik use the <span class="codefrag">org.w3c.</span>* packages.
          Depending on the version of FOP and Batik, Batik has been using a
          version of these packages which is more recent than the one in the
          <span class="codefrag">xml-apis.jar</span> file FOP uses. However, if the
          <span class="codefrag">xml-apis.jar</span> file that comes with the FOP distribution
          is loaded before the Batik jar files, then the version coming with
          FOP takes precedence (i.e., that is the version the Java Virtual
          Machine loads). Because that version is incompatible with Batik, you
          encounter this problem.
        </p>
<p>
          The solution is to either repackage the <span class="codefrag">xml-apis.jar</span> file
          with the classes in the Batik distribution (you will need the Batik
          source distribution to do that), or you will need to make sure the
          Batik jars are loaded before FOP&rsquo;s <span class="codefrag">xml-apis.jar</span>, for
          example by putting Batik&rsquo;s jar file before FOP&rsquo;s in your classpath.
          If you are copying your jar files to <span class="codefrag">.../jre/lib/ext</span>,
          you can simply remove the FOP <span class="codefrag">xml-apis.jar</span> file from
          that directory.
        </p>
</div>
<a name="N10357"></a><a name="how-to-checkout-latest-batik-via-svn"></a>
<h4 class="faq">3.11. 
        How do I checkout the latest SVN version of Batik?
      </h4>
<div align="right">
<a href="#how-to-checkout-latest-batik-via-svn-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          You just have to follow the instructions on the
          <a href="download.cgi">download page</a>.
        </p>
</div>
<a name="N10363"></a><a name="mac-os-x-messed-up-svg-files"></a>
<h4 class="faq">3.12. 
        I&rsquo;m using Mac OS X, and some of the SVG files I view are messed up
        (things appear clipped or out of place).  What do I need to do to fix
        this?
      </h4>
<div align="right">
<a href="#mac-os-x-messed-up-svg-files-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          As of Mac OS X release 10.1.1 there still appears to be
          problems in the Apple implementation of the Java 2D APIs. The
          true source of these problems and/or workarounds have yet to be
          identified (although the problems appear to be closely tied to a
          &ldquo;gstack underflow&rdquo; error message from the Apple JVM). We are
          interested in finding the source of these problems and
          reasonable workarounds, so if you know what causes these errors
          the Batik team would be very interested in hearing from you
          (either directly or through the user/developer mailing lists).
        </p>
<p>
          Other things to be aware of on Mac OS X, due to fixes for
          other problems with Java 2D under Mac OS X, you may find that
          some filtering operations take significantly more memory than on
          other platforms.  This will be especially true for deeply nested
          filter trees (where the result of one filtering operation is
          filtered by another filtering operation).
        </p>
<p>
          Finally a few hints on avoiding problems under Mac OS X. The
          bugs seems to be triggered by filters, and pure raster SVG documents
          have not been found to cause problems.  The use of the
          <span class="codefrag">filterRes</span> attribute on the <span class="codefrag">filter</span> element
          seems especially problematic.  The bug isn&rsquo;t 100% reproducible, so
          while some content exhibits the problem, if you play with the
          document enough it will often &ldquo;fix&rdquo; itself for a while, then later
          it will go back to being broken (which indicates that the problem may
          be some sort of race condition in the JVM).
        </p>
</div>
<a name="N10377"></a><a name="mac-os-x-batik-demo-crash"></a>
<h4 class="faq">3.13. 
        I cannot run the Batik demo on Mac OS X (10.1.1). The Batik splash
        screen hangs.  What is happening?
      </h4>
<div align="right">
<a href="#mac-os-x-batik-demo-crash-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          The Batik <a href="demo.html">demo</a> uses Java Web Start. Java Web
          Start (under the <span class="codefrag">Applications/Utilities</span> folder), lets
          you start a Java application from a web browser. You can see the
          debug traces by enabling the Java console for Java Web Start. If you
          do, you will see that there is a
          <span class="codefrag">java.lang.NoSuchMethodError</span> exception thrown.
        </p>
<p>
          This is happening because the Java Web Start jar file
          (<span class="codefrag">javaws.jar</span> in <span class="codefrag">/Applications/Utilities/Java Web
            Start/Content/MacOS</span>) contains an older version of the DOM
          bindings.
        </p>
<p>
          One work around is to manually patch the <span class="codefrag">javaws.jar</span>
          file to remove the DOM bindings so that they do not take precedence
          over the Batik ones.
        </p>
</div>
<a name="N10398"></a><a name="batik-dev"></a>
<h3 class="boxed">4. How do I contribute to Batik Development?</h3>
<a name="N1039C"></a><a name="how-can-i-contribute"></a>
<h4 class="faq">4.1. How can I contribute to Apache Batik development?</h4>
<div align="right">
<a href="#how-can-i-contribute-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          The Batik Project is an open volunteer project in the 
          spirit of the <a class="external" href="http://www.apache.org">Apache
            Software Foundation</a> (ASF).  This means that there are
          many ways to contribute to the project, either with direct
          participation (coding, documenting, answering questions,
          proposing ideas, reporting bugs, suggesting bug-fixes, etc.)
          or by resource donation (publicity, hardware, software,
          conference presentations, speeches, etc.). Applications that
          use the Batik modules, such as tools or extensions, are of special 
          interest to the project.
        </p>
<p>
          The process for contributing to Batik is the same as for other
          Java projects at Apache. A formal description of that process
          can be found on the <a class="external" href="http://jakarta.apache.org/guidelines/index.html">Jakarta</a>
          web site.  You can also view a list of
          <a href="contributors.html">who has contributed to Batik</a>.
        </p>
<p>
          For direct participation, we suggest that you subscribe to the
          <a href="mailing-lists.html">Batik mailing lists</a> and to
          checkout the
          <a class="external" href="http://svn.apache.org/viewcvs.cgi/xmlgraphics/batik/">latest
            code</a>.
        </p>
</div>
<a name="N103BE"></a><a name="submit-patches"></a>
<h4 class="faq">4.2. How do I submit patches or bug fixes?</h4>
<div align="right">
<a href="#submit-patches-menu">^</a>
</div>
<div style="margin-left: 15px">
<p>
          You can submit bug fixes and patches to the
          <a class="external" href="mailto:batik-dev@xmlgraphics.apache.org">Batik developers</a>
          mailing list and you can enter bugs in
          <a class="external" href="http://issues.apache.org/bugzilla/buglist.cgi?query_format=specific&bug_status=__open__&product=Batik">Bugzilla</a>.
        </p>
</div>
</div>
</div>
<!--+
    |end content
    +-->
<div class="clearboth">&nbsp;</div>
</div>
<div id="footer">
<!--+
    |start bottomstrip
    +-->
<div class="lastmodified">
<script type="text/javascript"><!--
document.write("Last Published: " + document.lastModified);
//  --></script>
</div>
<div class="copyright">
        Copyright &copy;
         2000&ndash;2008 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a>
</div>
<!--+
    |end bottomstrip
    +-->
</div>
</body>
</html>
